package cn.tedu.boot21.controller;

import cn.tedu.boot21.entity.User;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AxiosController {
    @RequestMapping("/helloAxios")
    public String helloAxios(String info , String msg){
        return "请求成功!"+info+msg;
    }
    /*
    *如果前端发出的是post请求并且参数为自定义的js对象,在服务器接收参数时候,需要
    * @RequestBody注解 否则接受不到参数
    * */
    @RequestMapping("/postAxios")
    public String postAxios(@RequestBody User user){
        return "post请求成功!"+user.toString();
    }
}
